<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="app" uri="http://www.wanrenhui.com" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	  <%@include file="/res/include/base-head.jsp"%>
	  <%@include file="/res/include/jquery-easyui.jsp"%>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/send/deliveryUser.js"></script>
  </head>
  <body>
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'north',border:false,split:false">
	    	<form id="query-form" class="search_form clearfix">
	            <dl>
					<dt>用户帐号：</dt>
					<dd>
						<input name="identity" id="identity" type="text" class="txt" maxlength="32"/>
					</dd>
				</dl>
				<dl>
					<dt>状态：</dt>
					<dd>
	                	<select name="status">
							<option value="">请选择</option>
							<option value="1">正常</option>
							<option value="2">暂停</option>
						</select>
					</dd>
				</dl>
	            <p class="search_form_btn">
	            	<input type="button" value="搜索" class="icon_serach" onclick="admin.deliveryUser.query()" />
	            	<input type="button" value="添加" class="icon_serach" onclick="admin.deliveryUser.toAdd()" />
	            </p>
	        </form>
	  	</div>
	    <div data-options="region:'center',border:false">
		    <table id="datagrid" data-options="url:'${pageContext.request.contextPath}/send/deliveryUser/list',toolbar:'#toolbar'">
				<thead>
					<tr>
						<th data-options="field:'identity',width:100,align:'center'">帐号</th>
						<th data-options="field:'userNick',width:80,align:'center'">昵称</th>
						<th data-options="field:'strRegisterAt',width:150,align:'center'">注册时间</th>
						<th data-options="field:'communityName',width:100,align:'center'">社区</th>
						<th data-options="field:'strStatus',width:80,align:'center'">状态</th>
						<th data-options="field:'strAuditStatus',width:80,align:'center'">审核状态</th>
						<th data-options="field:'strAuditAt',width:150,align:'center'">审核时间</th>
						<th data-options="field:'parentUserId',width:60,align:'center',formatter:formatParentUserId">一级配送</th>
						<th data-options="field:'hasSuperPower',width:60,align:'center',formatter:formatHasSuperPower">超级权限</th>
			            <th data-options="field:'id',align:'center',width:250,formatter:formatOperation">操作</th>
					</tr>
				</thead>
			</table>
	  	</div>
	</div>

	<script type="text/javascript">
		function formatParentUserId(value,row,index) {
			if (row.parentUserId == 0) {
				return '是';
			}
			return '否';
		}
		function formatHasSuperPower(value,row,index) {
			if (row.hasSuperPower == 1) {
				return '是';
			}
			return '否';
		}
		function formatOperation(value,row,index) {
			var l_html = '';
			l_html += '<a href="javascript:;" class="table_link"  onclick="admin.deliveryUser.edit('+row.id+')">编辑</a>';
			if (row.status == 1) {
				l_html += '|<a href="javascript:;" class="table_link"  onclick="admin.deliveryUser.setStatus('+row.id+',2)">暂停接单</a>';
			} else {
				l_html += '|<a href="javascript:;" class="table_link"  onclick="admin.deliveryUser.setStatus('+row.id+',1)">开启接单</a>';
			}
			if (row.auditStatus == 1) {
				l_html += '|<a href="javascript:;" class="table_link"  onclick="admin.deliveryUser.setAuditStatus('+row.id+',2)">审核通过</a>';
				l_html += '|<a href="javascript:;" class="table_link"  onclick="admin.deliveryUser.setAuditStatus('+row.id+',3)">审核不通过</a>';
			} else if (row.auditStatus == 2) {
				l_html += '|<a href="javascript:;" class="table_link"  onclick="admin.deliveryUser.setAuditStatus('+row.id+',3)">审核不通过</a>';
			} else {
				l_html += '|<a href="javascript:;" class="table_link"  onclick="admin.deliveryUser.setAuditStatus('+row.id+',2)">审核通过</a>';
			}
			return l_html;
		}
	</script>
  </body>
</html>
